package manage.action;

import m.common.action.ActionMeta;
import m.common.action.VuePageResult;
import m.common.action.VueResult;
import m.system.util.JSONMessage;
import manage.model.SystemInfo;
import manage.service.SystemInfoService;

@ActionMeta(name="manage/systemInfo")
public class SystemInfoAction extends ManageAction {
	private SystemInfo model;
	
	public JSONMessage get() {
		JSONMessage result=new JSONMessage();
		try {
			result.push("model", getService(SystemInfoService.class).getUniqueModel());
			fillJSONResult(result,true,"");
		} catch (Exception e) {
			fillJSONResult(result,false,e);
		}
		return result;
	}
	
	public JSONMessage doSave(){
		JSONMessage result=new JSONMessage();
		try {
			verifyAdminOperPower("manage_system_power");
			String msg=getService(SystemInfoService.class).save(model);
			fillJSONResult(result,true,msg);
		} catch (Exception e) {
			fillJSONResult(result,false,e);
		}
		return result;
	}
	public VueResult toEdit() throws Exception {
		verifyMenu("A1107");
		verifyAdminOperPower("manage_system_power");
		return new VuePageResult("page/base/editSystemInfo.js")
			.addParam("model",getService(SystemInfoService.class).getUniqueModel());
	}


	public SystemInfo getModel() {
		return model;
	}

	public void setModel(SystemInfo model) {
		this.model = model;
	}


}
